<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="配置Udev（适用于存储层快照备份）">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="ZH-CN_TOPIC_0000001864661961">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>配置Udev（适用于存储层快照备份）</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="ZH-CN_TOPIC_0000001864661961"></a><a name="ZH-CN_TOPIC_0000001864661961"></a>

<h1 class="topictitle1">配置Udev（适用于存储层快照备份）</h1>
<div><p>介绍使用UltraPath多路径软件场景Udev规则为每个磁盘配置设备映射权限和持久性，内容仅供参考。</p>
<div class="section"><h4 class="sectiontitle">操作步骤</h4><ol><li><span>识别设备标识符（WWID），以sdb为例。</span><p><ul><li>方法一：通过UltraPath工具查看。<pre class="screen">UltraPath CLI #0 &gt;show vlun
----------------------------------------------------------------------------------------------------------
 Vlun ID  Disk          Name                      Lun WWN               Status  Capacity  Ctrl(Own/Work)       
    0     sdb     LUN_200_grid0000    6c4ff1f100ee3d7501948ec2000002c5  Normal  10.00GB       0B/0B                     </pre>
<div class="note"><img src="public_sys-resources/note_3.0-zh-cn.png"><span class="notetitle"> </span><div class="notebody"><p>不同版本的UltraPath CLI命令可能不同，具体信息参考<a href="https://support.huawei.com/enterprise/zh/cloud-storage/ultrapath-pid-8576127?category=operation-maintenance" target="_blank" rel="noopener noreferrer">UltraPath用户指南</a>。</p>
</div></div>
</li><li>方法二：通过命令查看。<pre class="screen"># cd /dev/disk/by-id
[root@oracle1 by-id]# ll -lh 
lrwxrwxrwx 1 root root  9 Mar 12 17:08 wwn-0x6c4ff1f100ee3d7501948ec2000002c5 -&gt; ../../sdb</pre>
</li></ul>
</p></li><li><span>在<span class="filepath">“/etc/udev/rules.d/”</span>目录下创建<strong>99-oracle-asmdevices.rules</strong>文件。</span></li><li><span>在<strong>99-oracle-asmdevices.rules</strong>文件中，为每个磁盘设备创建类似的规则。</span><p><ul><li>RHEL7.x参考如下配置：<pre class="screen">KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u /dev/$name", RESULT=="36c4ff1f100ee3d7501948ec2000002c5", SYMLINK+="raw/LUN_200_DATA0000", OWNER="grid", GROUP="asmadmin", MODE="0660"</pre>
</li><li>RHEL6.x参考如下配置：<pre class="screen">KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace 
--device=/dev/$name",RESULT=="36c4ff1f100ee3d7501948ec2000002c5",SYMLINK+="raw/LUN_200_DATA0000",OWNER="grid",GROUP="oinstall",MODE="0660"</pre>
</li></ul>
<div class="note"><img src="public_sys-resources/note_3.0-zh-cn.png"><span class="notetitle"> </span><div class="notebody"><ul><li>增加的以上内容为一整行，如果拷贝以上内容至<strong>99-oracle-asmdevices.rules</strong>文件中存在换行时，请手动删除换行。</li><li>配置的规则各参数说明如下：<ul><li><strong>KERNEL</strong>：内核设备名称，例如：dm-2。</li><li><strong>BUS</strong>：设备在devpath里的总线名称，例如：scsi。</li><li><strong>PROGRAM</strong>：调用外部命令，例如：/usr/lib/udev/scsi_id -g -u /dev/dm-2或/sbin/scsi_id --whitelisted --device=/dev/$name。</li><li><strong>RESULT</strong>：外部命令PROGRAM的返回结果，例如：36207969100f4a3810efc24f70000001a（WWID）。</li><li><strong>SYMLINK</strong>：为/dev/下的设备文件产生符号链接。由于Udev只能为某个设备产生一个设备文件，所以为了不覆盖系统默认的Udev规则所产生的文件，推荐使用符号链接。SYMLINK的值可按照命名规则进行规划。</li><li><strong>OWNER, GROUP, MODE</strong>：为设备设定权限。</li></ul>
</li></ul>
</div></div>
</p></li><li><span>测试创建的Udev规则，测试过程如下所示：</span><p><pre class="screen"># udevadm test /sys/block/sdb
udevadm_test: UDEV_LOG=6
udevadm_test: DEVPATH=/devices/up_primary/up_adapter/host15/target15:0:0/15:0:0:1/block/sdb
udevadm_test: MAJOR=8
udevadm_test: MINOR=16
udevadm_test: DEVNAME=/dev/oracle/LUN_200_grid0000
udevadm_test: DEVTYPE=disk
udevadm_test: ACTION=add
udevadm_test: SUBSYSTEM=block
udevadm_test: DEVLINKS=/dev/block/8:16 /dev/disk/by-id/scsi-36c4ff1f100ee3d7501948ec2000002c5 /dev/disk/by-path/scsi-0:0:0:1 /dev/disk/by-id/wwn-0x6c4ff1f100ee3d7501948ec2000002c</pre>
</p></li><li><span>确认设备所需的权限，如下所示：</span><p><pre class="screen"># ls -lh /dev
brw-rw---- 1 grid oinstall  8,  16 Mar 12 19:35 sdb</pre>
<div class="note"><img src="public_sys-resources/note_3.0-zh-cn.png"><span class="notetitle"> </span><div class="notebody"><p>如果所需的权限不正确,请重新启动节点或重新启动Udev服务。例如：</p>
<p>RHEL7.x</p>
<pre class="screen">udevadm control --reload-rules
udevadm trigger
或
udevadm trigger --type=devices --action=change</pre>
<p>RHEL6.x</p>
<pre class="screen">udevadm control --reload-rules
<span style="color:#4B4B4B;">start_udev</span></pre>
</div></div>
</p></li></ol>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>